package controllers

import (
	"github.com/astaxie/beego"
	"wifiprobe/models"
)

type ApiController struct {
	beego.Controller
}

func (this *ApiController) Get() {
	this.TplName = "api.html"
}

func (this *ApiController) Post() {
	var post_data models.Postdata
	this.TplName = "api.html"
	var req []byte = this.Ctx.Input.RequestBody
	post_data.Analysisjson(Substr2(string(req[:]), 5))
	if string(req[:]) == "" {
		this.Ctx.WriteString("JsonData is empty!")
		return
	}
}

func Substr2(str string, start int) string {
	rs := []rune(str)
	return string(rs[start:])
}
